/**
 * 存放我的工具类
 */

/**
 * 全局变量，存放正在操作/被操作的的
 * 用户、贴吧、贴子
 */
let nowUser;
let nowPostBar;
let nowPost;

// 鼠标在上边时的颜色
function over(obj) {
    obj.style.backgroundColor = "#FFFCCC";
}

// 鼠标离开时的颜色
function out(obj) {
    obj.style.backgroundColor = "#FFFFFF";
}

// 将 json 数组按日期排序（true 降序 / false 升序）
function sortCreateDate(jsonList, style) {
    jsonList.sort(function (a, b){
        if (style) {
            return (new Date(b.createDate)).getTime() - (new Date(a.createDate)).getTime();
        } else {
            return (new Date(a.createDate)).getTime() - (new Date(b.createDate)).getTime();
        }
    });
}

// 判断图片是否满足要求
function checkImage(select) {
    //判断文件类型,是否为指定格式的图片
    const suffix = select.val().substring(select.val().lastIndexOf(".") + 1).toLowerCase();
    if(!(suffix === "png" || suffix ==="jpg" || suffix === "jpeg")){
        alert("必须上传 png、jpg 或 jpeg 格式的图片!");
        return false;
    }

    //判断文件大小
    const size = select[0].files[0].size;
    if (size > 5 * 1024 * 1024) {
        alert("图片大小不能大于 5M! ");
        return false;
    }

    return true;
}

// 通过用户 id 请求得到用户数据（同步请求）
function findUser(userId) {
    let user = null;

    $.ajaxSettings.async = false;
    $.get("/QG_PostBar/user?method=getUserById", {"userId": userId}, function (data){
        user = data;
    }, "json");
    $.ajaxSettings.async = true;

    return user;
}

// （适用于贴子，贴吧的显示）向指定父容器中增加新数据
function addItem(parent, href, title, detail, creator, createDate) {
    const itemData =
        `<div class="row" style="border: 1px solid black" onmouseover=over(this) onmouseout=out(this)>
             <div class="col-md-12" style="height: 10px"></div>
             <a class="col-md-12" style="font-size: 23px; font-weight: bold; font-family: 微软雅黑,serif" target="_blank" href="`+href+`">` + title +`</a>
             <div class="col-md-12" style="height: 10px"></div>
    
             <label class="col-md-12" style="font-size: 15px; height: 25px; color: #555555; overflow: hidden;white-space: nowrap;text-overflow:ellipsis;">` + detail +`</label>
             <label class="col-md-12" style="font-size: 12px; color: #555555">` + creator + `&nbsp;&nbsp;&nbsp;&nbsp;` + createDate + `</label>
         </div><br>`;

    parent.append(itemData);
}

// （适用于公告贴）向指定父容器添加公告贴
function addNotice(parent, href, title, createDate) {
    const noticeData = `
        <div class="row" style="border: 1px solid black; padding: 5px" onmouseover=over(this) onmouseout=out(this)>
            <a class="col-md-6" style="color: #FF0000; font-size: 16px; font-weight: bold; font-family: 微软雅黑,serif" target="_blank" href="`+href+`">` + title +`</a>
            <label class="col-md-6" style="font-size: 14px; color: #666666; text-align: right">`+ createDate +`</label>
        </div><br>`;

    parent.append(noticeData);
}

// （适用于评论的显示）传入一个父容器和一个贴子回复对象即可，外加一个回调函数，当有根回复被删除时，刷新贴子
function addCommentItem(parent, postComment, update) {
    let user = findUser(postComment.userId);
    let userHead = "head.jpeg";

    if (user.userHead != null) {
        userHead = "/QG_PostBar/user_head/" + user.userHead;
    }

    const commentItemData = `
        <div class="rootComment">
            <!--用户信息区域-->
            <div class="col-md-2">
                <div class="col-md-12" style="height: 20px"></div>
                <div class="col-md-12" style="text-align: center"><img class="img-circle" style="height: 70px; width: 70px" src="` + userHead + `" id="postCreatorHead" alt="头像"></div>
                <a class="col-md-12" style="font-size: 18px; text-align: center" href="userHome.html?userId=`+ user.userId +`">` + user.userName +`</a>
            </div>
    
            <!--用户回复区域-->
            <div class="col-md-10"  style="border-left: 1px solid darkgray; padding: 5px">
                <div class="col-md-12" style="height: 10px"></div>
                <!--回复的内容-->
                <div class="col-md-12" style="min-height: 100px; padding: 5px; color: #333333; font-weight: bold">` + postComment.commentContent + `</div>
                <div class="col-md-12" style="height: 10px"></div>
                
                <!--回复发布的日期-->
                <label class="col-md-5" style="color: #666666" >` + postComment.createDate + `</label>
                <!--回复所在的楼层-->
                <label class="col-md-4" style="text-align: right; color: #666666">第 `+ postComment.commentFloor +` 楼</label>
                <!--回复的删除-->
                <div class="col-md-1" style="text-align: right;">
                <label style="color: #0000cc; font-size: 14px; cursor: pointer; display: none" id="deletePostComment_`+ postComment.commentId +`">删除</label>
                </div>
                <!--回复的发送按钮-->
                <label class="col-md-1" style="text-align: right; color: #0000cc; cursor: pointer; display: none" id="createCommentReply_`+ postComment.commentId +`">发送</label>
                <!--回复的回复按钮-->
                <label class="col-md-1" style="text-align: right; color: #0000cc; cursor: pointer" id="reply_`+ postComment.commentId +`">回复</label>
                <!--回复内容编辑框-->
                <textarea class="col-md-12" style="font-size: 15px; padding: 5px; display: none; margin-bottom: 10px" id="editCommentReply_`+ postComment.commentId +`"></textarea>
                
                <!--回复的回复列表区域-->
                <div class="col-md-12" style="background: #EEEEEE; display: none" id="commentReply_`+ postComment.commentId +`">
                    <!--回复列表的条数显示（显示该回复有多少条回复）-->
                    <label class="col-md-12" style="font-size: 15px; padding: 5px; color: #666666" id="replyNum_`+ postComment.commentId +`">共 `+ postComment.commentReply +` 条回复</label>
                    <!--回复列表显示（显示的都为子回复，id里边包含了根回复的 id ，用于区分）-->
                    <div class="col-md-12 row-no-gutters" id="commentReplyList_`+postComment.commentId+`"></div>
    
                    <div class="col-md-12" style="height: 20px"></div>
    
                    <!--显示翻页器-->
                    <!--这里边定义了变量 nowPage 和 maxPage 分别表示翻页器=当前所在页数和总页数，用 maxDisplay 标识最多显示多少条数据-->
                    <div class="col-md-6 col-md-offset-3" nowPage="1" maxPage="1" maxDisplay="4" id="replyTurner_`+ postComment.commentId +`">
                        <label class="col-md-2 col-md-offset-2" style="cursor: pointer; text-align: center" id="replyPriorPage_`+ postComment.commentId +`">上一页</label>
                        <label class="col-md-2 col-md-offset-1" style="font-size: 15px; text-align: center" id="replyPageLabel_`+ postComment.commentId +`">1 / 1</label>
                            <label class="col-md-2 col-md-offset-1" style="cursor: pointer; text-align: center;" id="replyNextPage_`+ postComment.commentId +`">下一页</label>
                    </div>
                </div>
            </div>
        <!--分割行-->
        <div class="col-md-12" style="border-bottom: 1px solid darkgray"></div>
        </div>`;



    parent.append(commentItemData);

    // 为回复按钮和发送按钮绑定点击事件
    $(eval("reply_" + postComment.commentId)).click(function (){ replyComment(postComment) });
    $(eval("createCommentReply_" + postComment.commentId)).click(function (){ createPostCommentReply(postComment) });

    // 为翻页器绑定点击事件
    $(eval("replyPriorPage_" + postComment.commentId)).click(function (){
        updatePageTurner(postComment, -1);
        getPageCommentReply(postComment);
    });
    $(eval("replyNextPage_" + postComment.commentId)).click(function (){
        updatePageTurner(postComment, 1);
        getPageCommentReply(postComment);
    });

    // 判断是否有删除权限
    // 有权限的：回复发布者、贴子创建者（楼主）
    if (nowUser.userId === postComment.userId || nowUser.userId === nowPost.userId) {
        $(eval("deletePostComment_" + postComment.commentId)).show();
    }

    // 为删除按钮绑定事件
    $(eval("deletePostComment_" + postComment.commentId)).click(function (){
        $.get("/QG_PostBar/post?method=deletePostComment", {"postCommentId": postComment.commentId}, function (data) {
            if (data === "true") {
                success_prompt("删除成功");

                // 刷新贴子
                update();
            }
        });
    });

    // 如果该评论有子评论，那么将子评论列表显示出来
    if (postComment.commentReply > 0) {
        // 获取该评论的子评论列表
        $(eval("commentReply_" + postComment.commentId)).show();

        // 更新子评论列表翻页器，不需要执行翻页
        updatePageTurner(postComment, 0);
        getPageCommentReply(postComment);
    }
}

// （适用于子评论的显示）传入一个评论回复列表作为父容器、一个评论回复对象和该回复的根回复对象即可
function addCommentReplyItem(parent, commentReply, rootComment) {
    let user = findUser(commentReply.userId);
    let userHead = "head.jpeg";

    if (user.userHead != null) {
        userHead = "/QG_PostBar/user_head/" + user.userHead;
    }

    const commentReplyItemData = `
        <div class="commentReply">
            <!--用户信息区域-->
            <div class="col-md-12" style="height: 10px"></div>
            
            <div class="col-md-12">
                <div class="col-md-1" style="text-align: center"><img class="img-circle" style="height: 40px; width: 40px" src="` + userHead + `" alt="头像"></div>
                <a class="col-md-11" style="font-size: 18px" href="userHome.html?userId=`+ user.userId +`">` + user.userName +`</a>

            </div>
    
            <!--用户回复区域-->
            <div class="col-md-10 col-md-offset-1">
                <!--回复的内容-->
                <div class="col-md-12" style="color: #333333; font-weight: bold">` + commentReply.commentContent + `</div>
                <!--回复发布的日期-->
                <label class="col-md-6" style="color: #666666" >` + commentReply.createDate + `</label>
                <!--显示删除回复按钮-->
                <label class="col-md-6" style="color: #0000cc; text-align: right; cursor: pointer; display: none" id="deleteReplyComment_`+ commentReply.commentId +`">删除</label>
            </div>
        <!--分割行-->
        <div class="col-md-12" style="border-bottom: 1px solid darkgray"></div>
        </div>`;

    parent.append(commentReplyItemData);

    // 判断有无权限删除该子回复
    // 有权限的：子回复的发布者、贴子创建者（楼主）
    if (nowUser.userId === commentReply.userId || nowUser.userId === nowPost.userId) {
        $(eval("deleteReplyComment_" + commentReply.commentId)).show();
    }

    // 为评论回复删除按钮绑定事件
    $(eval("deleteReplyComment_" + commentReply.commentId)).click(function (){
        $.get("/QG_PostBar/post?method=deletePostComment", {"postCommentId": commentReply.commentId}, function (data) {
            if (data === "true") {
                success_prompt("删除成功");
                // 评论列表的回复数 -1
                rootComment.commentReply--;

                // 更新翻页器，不需要翻页
                updatePageTurner(rootComment, 0);

                // 刷新子评论列表（已删除的要干掉、如果删除完已经没有评论了，要隐藏掉）
                $(eval("replyNum_" + rootComment.commentId)).html("共 " + rootComment.commentReply + " 条评论");
                if (rootComment.commentReply === 0) {
                    $(eval("commentReply_" + rootComment.commentId)).hide();
                }

                getPageCommentReply(rootComment);
            }
        });
    });
}

/**
 * 负责更新翻页器数据
 * 根据根评论对象获取到翻页器和显示标签
 * 再从根回复中取出子回复的数量，更新最大页数显示
 * 然后通过翻页标识、当前页数和最大页数判断如何执行翻页操作
 * @param rootComment 根评论对象
 * @param turnPage 翻页标识（-1表示上一页，0表示不翻页，1表示下一页）
 */
function updatePageTurner(rootComment, turnPage) {
    // 获取该评论所属的翻页器和显示标签
    let replyTurner = $(eval("replyTurner_" + rootComment.commentId));
    let replyPageLabel = $(eval("replyPageLabel_" + rootComment.commentId));

    // 获取到当前评论的子回复数量
    let replyNum = rootComment.commentReply;

    // 获取到翻页器的当前页数和最大显示数量
    let nowPage = parseInt(replyTurner.attr("nowPage"));
    let maxDisplay = parseInt(replyTurner.attr("maxDisplay"));

    // 计算最大页数
    let newMaxPage;
    if (replyNum === 0) {
        newMaxPage = 1
    } else {
        newMaxPage =  Math.floor((replyNum-1) / maxDisplay) + 1;
    }

    // 判断翻页标识
    if (nowPage+turnPage > 0 && nowPage+turnPage <= newMaxPage) {
        nowPage += turnPage;
    }

    // 判断更新后的页数变化（可能执行了删除操作，导致当前页数小于最大页数，这时候要将当前页数改为最大页数）
    if (nowPage > newMaxPage) {
        nowPage = newMaxPage;
    }

    // 将新的数据显示出来
    replyPageLabel.html(nowPage + " / " + newMaxPage);

    // 将新的数据更新到翻页器中
    replyTurner.attr("nowPage", "" + nowPage);
    replyTurner.attr("maxPage", "" + newMaxPage);
    replyTurner.attr("maxDisplay", "" + maxDisplay);
}

/**
 * 负责根据翻页器的数据去服务器获取数据，并显示出来
 * 通过根回复获取到子回复列表，用于显示新获取到的数据
 * 通过根回复获取到回复列表的翻页器，用于读取目前翻页器所在的页数
 * @param rootComment 对应的根回复
 */
function getPageCommentReply(rootComment) {
    // 以特定的 id 命名形式获取到该评论的子评论列表和翻页器
    let commentReplyList = $(eval("commentReplyList_" + rootComment.commentId));
    let replyTurner = $(eval("replyTurner_" + rootComment.commentId));

    // 获取翻页器目前所在的页数和最大显示数量
    let nowPage = parseInt(replyTurner.attr("nowPage"));
    let maxDisplay = parseInt(replyTurner.attr("maxDisplay"));

    // 传入对应的根回复 id、页数，获取到该回复的子回复
    $.post("/QG_PostBar/post?method=getAllPostCommentByPage", {"postId": rootComment.postId,"rootCommentId": rootComment.commentId, "page": nowPage, "num": maxDisplay}, function (data){
        // 先清空列表
        commentReplyList.empty();

        // 将数据取出来并显示（将这一部分设置为同步请求，保证各个评论的顺序）
        $.ajaxSettings.async = false;
        for (const key in data) {
            // 获取评论对象，并添加进去
            addCommentReplyItem(commentReplyList, data[key], rootComment);
        }
        $.ajaxSettings.async = true;
    }, "json");
}

// 评论回复按钮的点击触发（传入根回复）
function replyComment(rootComment) {
    let reply = $(eval("reply_" + rootComment.commentId));
    let createCommentReply = $(eval("createCommentReply_" + rootComment.commentId));
    let editCommentReply = $(eval("editCommentReply_" + rootComment.commentId));
    let status = reply.html();

    // 如果是想回复
    if(status === "回复") {
        // 显示输入框和发送按钮，并将按钮设置为取消样式
        editCommentReply.show();
        createCommentReply.show();
        reply.html("取消");
    } else {
        // 清空并隐藏输入框、隐藏发送按钮，并将按钮设置为回复样式
        editCommentReply.val("");
        editCommentReply.hide();
        createCommentReply.hide();
        reply.html("回复");
    }
}

// 创建评论的回复
function createPostCommentReply(rootComment) {
    // 获取输入框，得到输入的内容
    let editCommentReply = $(eval("editCommentReply_" + rootComment.commentId));

    // 获取正在输入的用户
    let user = null;
    $.ajaxSettings.async = false;
    $.post("/QG_PostBar/user?method=getUserBySession", function (data) {
        user = data;
    }, "json");
    $.ajaxSettings.async = true;

    let commentContent = editCommentReply.val();
    // 保存到数据库
    $.post("/QG_PostBar/post?method=createPostComment",
        {"postId": rootComment.postId, "userId": user.userId ,"rootCommentId": rootComment.commentId, "commentContent": commentContent}, function (data) {

            if (data.commentContent != null) {
                // 发送一条信息通知被回复的用户
                $.post("/QG_PostBar/message?method=createMessage",
                    {"senderId": user.userId, "receiverId": rootComment.userId, "messageContent": commentContent, "messageClass": 1, "messageHref": "/QG_PostBar/post?method=getPostById&postId=" +rootComment.postId + "&isClick=true"});

                success_prompt("回复评论成功");
                // 评论列表的回复数 +1
                rootComment.commentReply++;

                // 更新翻页器，不需要翻页
                updatePageTurner(rootComment, 0);

                // 刷新子评论列表（尚未显示的要显示出来）
                $(eval("replyNum_" + rootComment.commentId)).html("共 " + rootComment.commentReply + " 条评论");
                $(eval("commentReply_" + rootComment.commentId)).show();
                getPageCommentReply(rootComment);
            } else {
                alert("发布回复失败！请再次尝试");
            }
        }, "json");

    // 触发一次隐藏掉输入框和发送按钮
    replyComment(rootComment);
}

// （适用于贴吧审核的显示）传入一个父容器和一个贴吧对象即可（外加回调函数记录数目）
function addPostBarItem(parent, postBar, finish) {
    let user = findUser(postBar.userId);
    let userHead = "head.jpeg";

    if (user.userHead != null) {
        userHead = "/QG_PostBar/user_head/" + user.userHead;
    }

    const postBarItemData = `
        <!--显示吧主与贴吧信息-->
        <div class="col-md-12 row-no-gutters" style="border-bottom: 1px solid black" id="item_`+ postBar.postBarId +`">
            <!--吧主信息-->
            <div class="col-md-2">
                <div class="col-md-12" style="height: 20px"></div>
                <div class="col-md-12" style="text-align: center"><img class="img-circle" src="` + userHead + `" style="width: 50px; height: 50px" id="creatorHead" alt="头像"></div>
                <a class="col-md-12" style="font-size: 20px; font-weight: bold ;font-family: 微软雅黑,serif; text-align: center" id="creator"  href="userHome.html?userId=`+ user.userId +`">`+ user.userName +`</a>
            </div>
    
            <!--贴吧信息-->
            <div class="col-md-10" style="border-left: 1px solid black; min-height: 100px">
                <div class="col-md-12" style="height: 10px"></div>
                <label class="col-md-12" style="font-size: 18px; font-weight: bold ;font-family: 微软雅黑,serif; padding-left: 10px" id="postBarName">吧名：`+ postBar.postBarName +`</label>
                <div class="col-md-12" style="height: 10px"></div>
                <p class="col-md-12" style="font-size: 18px; font-weight: bold ;font-family: 微软雅黑,serif; padding-left: 10px; text-align: justify; white-space: pre-wrap" id="postBarResume">简介：`+ postBar.postBarResume +`</p>
                <div class="col-md-12" style="height: 10px"></div>
                
                <!--审核不通过-->
                <label class="col-md-3 col-md-offset-6" style="font-size: 15px; color: #ac2925; text-align: right; cursor: pointer" onclick="rejectCreate(`+ postBar.postBarId+ `,'` + postBar.postBarName + `',` + postBar.userId +`, finish)">拒绝创建</label>
                <!--审核通过-->
                <label class="col-md-3" style="font-size: 15px; color: #4cae4c; text-align: right; cursor: pointer" onclick="agreeCreate(`+ postBar.postBarId+ `,'` + postBar.postBarName + `',` + postBar.userId +`, finish)">同意创建</label>
            </div>
        </div>`;

    parent.append(postBarItemData);
}

// 同意创建贴吧
function agreeCreate(postBarId, postBarName, userId, finish) {
    $.get("/QG_PostBar/postBar?method=checkCreatePostBar", {"postBarId": postBarId, "checkMessage": "agree"}, function (data){
        if (data === "true") {
            // 发送一条消息给指定用户
            $.post("/QG_PostBar/message?method=createMessage",
                {"receiverId": userId, "messageContent": "您创建的贴吧 < "+ postBarName +" > 已通过审核", "messageClass": 0});

            finish();
            $("#item_" + postBarId).remove();
            success_prompt("处理成功");
        }
    });
}

// 拒绝创建贴吧，要求系统管理员写明理由
function rejectCreate(postBarId, postBarName, userId, finish) {
    let message = "您创建的贴吧 < "+ postBarName +" > 审核不通过";
    let reason = prompt("请输入拒绝通过的原因");
    if (reason !== "") {
        message = message + ",原因如下：\n" + reason;
    }

    $.get("/QG_PostBar/postBar?method=checkCreatePostBar", {"postBarId": postBarId, "checkMessage": "reject"}, function (data){
        if (data === "true") {
            // 发送一条消息给指定用户
            $.post("/QG_PostBar/message?method=createMessage",
                {"receiverId": userId, "messageContent": message, "messageClass": 0});

            finish();
            $("#item_" + postBarId).remove();
            success_prompt("处理成功");
        }
    });
}

// （适用于贴子恢复的显示）传入一个父容器和一个贴子对象即可（外加回调函数记录数目）
function addPostItem(parent, post, finish) {
    let user = findUser(post.userId);
    let userHead = "head.jpeg";

    if (user.userHead != null) {
        userHead = "/QG_PostBar/user_head/" + user.userHead;
    }

    const postItemData = `
        <!--显示贴子与贴子标题-->
        <div class="col-md-12 row-no-gutters" style="border-bottom: 1px solid black" id="postItem_`+ post.postId +`">
            <!--贴子创建者信息-->
            <div class="col-md-2">
                <div class="col-md-12" style="height: 20px"></div>
                <div class="col-md-12" style="text-align: center"><img class="img-circle" src="` + userHead + `" style="width: 50px; height: 50px" id="creatorHead" alt="头像"></div>
                <a class="col-md-12" style="font-size: 20px; font-weight: bold ;font-family: 微软雅黑,serif; text-align: center" id="creator"  href="userHome.html">`+ user.userName +`</a>
            </div>
    
            <!--贴子信息-->
            <div class="col-md-10" style="border-left: 1px solid black; min-height: 100px">
                <div class="col-md-12" style="height: 10px"></div>
                <a class="col-md-12" style="font-size: 20px;padding-left: 10px ; font-weight: bold; font-family: 微软雅黑,serif" target="_blank" href="/QG_PostBar/post?method=getPostById&postId=` +post.postId + `&isClick=true">标题：` + post.postName +`</a>
                <div class="col-md-12" style="height: 10px"></div>
                <label class="col-md-12" style="font-size: 15px; padding-left: 10px; color: #666666">日期：`+ post.createDate +`</label>

                <!--恢复贴子-->
                <label class="col-md-12" style="font-size: 15px; color: #4cae4c; text-align: right; cursor: pointer" onclick="recoverPost(`+ post.postId +`, `+ `finish)">恢复贴子</label>
            </div>
        </div>`;

    parent.append(postItemData);
}

// 回收贴子
function recoverPost(postId, finish) {
    $.get("/QG_PostBar/post?method=recoverPost", {"postId": postId}, function (data){
        if (data === "true") {
            finish();
            $("#postItem_" + postId).remove();
            success_prompt("处理成功");
        }
    });
}

// （适用于消息的显示）传入一个父容器和一个消息对象即可
function addMessageItem(parent, message) {
    let sender = findUser(message.senderId);
    let senderHead = "head.jpeg";

    if (sender.userHead != null) {
        senderHead = "/QG_PostBar/user_head/" + sender.userHead;
    }

    // 判断信息中有无存放链接，有的话添加跳转
    let title;
    if (message.messageHref === null) {
        title = `<label class="col-md-12" style="font-size: 20px; font-family: 微软雅黑,serif" id="sender">`+ sender.userName +`</label>`;
    } else {
        title = `<a class="col-md-12" style="font-size: 20px; font-family: 微软雅黑,serif" id="sender" href="`+ message.messageHref +`">`+ sender.userName +`</a>`;
    }

    const messageItemData = `
        <!--显示发送者信息信息-->
        <div class="row row-no-gutters" style="border-bottom: 1px solid black" id="item_`+ message.messageId +`">
            <div class="col-md-12" style="height: 10px"></div>
            <!--发送者头像-->
            <div class="col-md-1 row-no-gutters">
                <div class="col-md-12" style="height: 5px"></div>
                <div class="col-md-12" style="text-align: center"><img class="img-circle" src="` + senderHead + `" style="width: 60px; height: 60px" alt="头像"></div>
            </div>
    
            <!--发送者名称即内容预览-->
            <div class="col-md-9" style="min-height: 70px; margin-left: 5px">
                <div class="col-md-12" style="height: 5px"></div>
                `+ title +`
                <label class="col-md-12" style="font-size: 16px; color: #666666; font-family: 微软雅黑,serif; overflow: hidden;white-space: nowrap;text-overflow:ellipsis;" id="postBarResume">`+ message.messageContent +`</label>
            </div>
            
            <div class="col-md-12" style="height: 10px"></div>
        </div>`;

    parent.append(messageItemData);
}

